#include "stdio.h"
#include "usart.h"

#define STDIO_USART			USART3
#define STDIO_USART_BDR		921600
#define STDIO_USART_BUFLEN	64

struct __FILE {
	int handle;
};


FILE __stdin;  
FILE __stdout;
FILE __stderr;

static int UART_INIT = 0;
/*
** @ Put character to a file
**/
int fputc ( int character, FILE * stream ) {
	
#if (1)
	unsigned char cBuf = character;
	
	if(!UART_INIT) {
		UART_INIT = 1;
		USART_Open(STDIO_USART, STDIO_USART_BDR, STDIO_USART_BUFLEN);
	}
	USART_Putc(STDIO_USART, cBuf);
	
	//USART_Write(STDIO_USART, cBuf, sizeof(cBuf));
#endif
	return character;
}
